package com.jk.controller;

import com.jk.entity.*;
import com.jk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("user")
@CrossOrigin(origins = "*")
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("getYhList")
    public List<UserEntity> getYhList(UserEntity user){
        return userService.getYhList(user);
    }
    @RequestMapping("getYhList1")
    public List<UserEntity> getYhList1(UserEntity user){
        return userService.getYhList1(user);
    }
    @RequestMapping("getHyList")
    public List<UserEntity> getHyList(UserEntity user){
        return userService.getHyList(user);
    }

    @RequestMapping("deleteUserById")
    public void deleteUserById(Integer id){
        userService.deleteUserById(id);
    }

    @RequestMapping("updateUser")
    public void updateUser(UserEntity user){
        userService.updateUser(user);
    }

    @RequestMapping("getUserProject")
    public  List<ProductEntity> getUserProject(String ids){
        return userService.getUserProject(ids);
    }
    @RequestMapping("getComboList")
    public  List<ComboEntity> getComboList(String ids){
        return userService.getComboList(ids);
    }
    @RequestMapping("getProList")
    public  List<ProductEntity> getProList(){
        return userService.getProList();
    }

    @RequestMapping("getUserById")
    public UserEntity getUserById(Integer id){
        return userService.getUserById(id);
    }


    @RequestMapping("getFunList")
    public List<FunctionEntity> getFunList(){
        return userService.getFunList();
    }
    @RequestMapping("getAddress")
    public List<AddEntity> getAddress(){
        return userService.getAddress();
    }

    @RequestMapping("insertRece")
    public void insertRece(ReceEntity rece){
         userService.insertRece(rece);
    }
    @RequestMapping("updateDefa")
    public void updateDefa(){
         userService.updateDefa();
    }

    @RequestMapping("updateSetting")
    public void updateSetting(ReceEntity rece){
         userService.updateSetting(rece);
    }

//    登录界面传值到index查询
    @RequestMapping("selectUser")
    public UserEntity selectUser(UserEntity userEntity){

        return userService.selectUser(userEntity);
    }



    /**
     * @description: 注册验证码
     * @author: mhj
     * @date: 2022/11/9 11:21
     * @param: [phone]
     * @return: java.util.Map
     **/
    @RequestMapping("sendCode")
    public Map sendCode(String phone){
        return userService.sendCode(phone);
    }

    /**
     * @description:注册
     * @author: mhj
     * @date: 2022/11/9 14:15
     * @param: [userEntity]
     * @return: java.util.Map
     **/
    @RequestMapping("registerUser")
    public Map registerUser(UserEntity userEntity){
        return userService.registerUser(userEntity);
    }

    /**
     * @description:登录
     * @author: mhj
     * @date: 2022/11/9 15:14
     * @param: [userEntity]
     * @return: java.util.Map
     **/
    @RequestMapping("loginuser")
    public Map loginuser(UserEntity userEntity){
        return userService.loginuser(userEntity);
    }

    //根据id查询
    @RequestMapping("userlist")
    public UserEntity userlist(Integer userId){
        return userService.userlist(userId);
    }

    //修改用户
    @RequestMapping("getupdate")
    public void getupdate(UserEntity userEntity){
         userService.getupdate(userEntity);
    }
    //修改密码
    @RequestMapping("getpwdupdate")
    public void getpwdupdate(UserEntity userEntity){
        userService.getpwdupdate(userEntity);
    }

    //查看秒杀订单
    @RequestMapping("getOrderList")
    public  List<OrderEntity> getOrderList(OrderEntity orderEntity){
        return userService.getOrderList(orderEntity);
    }
    @RequestMapping("updateOrderList")
    public void updateOrderList(UserEntity user){
        userService.updateOrderList(user);
    }













}
